var nickname = getValueByParam('nickname');

$(() => {
	initValue();
	initListener();
})

initValue = () => {
	$(`#nick_name`).val(nickname);
}

initListener = () => {
	$("#clear_nick_name").on('click', (e) => {
		$(`#nick_name`).val('');
	});
	$("#save").on('click', (e) => {
		onSave();
	});
}

onSave = () => {
	let inputText = $(`#nick_name`).val().trim();
	if (inputText == '') {
		showToast('请输入昵称');
		return
	}
	let subLoading = layer.open({
		type: 2,
		shadeClose: false,
		content: '正在保存...'
	});

	setTimeout(() => {
		layer.close(subLoading);
		showToast('保存成功！');
		goBack();
	}, 500)
}
